﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace RainyPWS.Model
{
    public interface IModel
    {
        int ColumnCount { get; }
        Type ColumnListEnumType { get; }
    }

    public abstract class Model
    {
        protected object[] moData;

        protected Model() { }

        protected Model(int upperBound, bool initDBNull)
        {
            moData = new object[upperBound];
            if (initDBNull)
            {
                for (int i = 0; i < upperBound; i++)
                {
                    moData[i] = DBNull.Value;
                }
            }
        }

        protected object GetValue<T>(T column)
        {
            int index = Convert.ToInt32(column);
            return moData[index];
        }

        protected void SetValue<T>(T column, object value)
        {
            int index = Convert.ToInt32(column);
            moData[index] = value;
        }
    }
}
